//
//  YHYRESubHeadTableViewCell.m
//  TripTogether
//
//  Created by 杨泓晔 on 15/12/29.
//  Copyright © 2015年 王军岐. All rights reserved.
//

#import "YHYRESubHeadTableViewCell.h"

#import "WJQdetail_listModel.h"

#import "SizeForLabel.h"

#import "YHYReSubEveryButtonViewController.h"
@interface YHYRESubHeadTableViewCell ()

@property (nonatomic,strong)UIImageView *userImageView;
//@property (nonatomic,strong)UIScrollView *myScrollView;
@property (nonatomic,strong)UILabel *myTextContentLabel;/**<内容*/
@property (nonatomic,strong)UILabel *myLabelName;
@property (nonatomic,strong)UILabel *textStoryLabel;/**<故事发生在*/
@property (nonatomic,strong)UILabel *nameAddressLabel;/**<地址*/

@end


@implementation YHYRESubHeadTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatView];
    }
    return  self;
}



- (void)creatView{
    self.backgroundColor = [UIColor colorWithRed:0.980 green:0.961 blue:0.910 alpha:1.000];
    
    
    _userImageView = [UIImageView new];
    _userImageView.backgroundColor = [UIColor lightGrayColor];
    [self.contentView addSubview:_userImageView];
    [_userImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView).offset(17);
        make.top.mas_equalTo(30);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(50);
        
    }];
  //  [_userImageView sd_setImageWithURL:[NSURL URLWithString:self.myUserImage] placeholderImage:PICHOLDEER];
    _userImageView.layer.masksToBounds = YES;
    //    设置半径
    _userImageView.layer.cornerRadius = 25;
   // [_userImageView sd_setImageWithURL:[NSURL URLWithString:self.pic] placeholderImage:PICHOLDEER];
    
    
    
    
    _myLabelName = [UILabel new];
    [self.contentView addSubview:_myLabelName];
    //_myLabelName.text = self.myUserName;
    _myLabelName.font = [UIFont fontWithName:@"Arial Rounded MT Bold" size:20];
    _myLabelName.textColor = [UIColor colorWithWhite:0.182 alpha:1.000];
    
    [_myLabelName mas_makeConstraints:^(MASConstraintMaker *make) {
        //  make.right.mas_equalTo(self.contentView.mas_right).offset(-10);
        make.width.mas_equalTo(170);
        make.top.mas_equalTo(_userImageView).offset(10);
        make.left.mas_equalTo(_userImageView.mas_right).offset(10);
        make.height.mas_equalTo(20);
        
    }];
   
   
    
    
    
    
    _textStoryLabel = [UILabel new];
    [self.contentView addSubview:_textStoryLabel];
   // _textStoryLabel.text = @"故事发生在";
    _textStoryLabel.font = [UIFont fontWithName:@"Gill Sans" size:14];
    _textStoryLabel.textColor = [UIColor colorWithWhite:0.416 alpha:1.000];
    [_textStoryLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(74);
        make.top.mas_equalTo(_myLabelName.mas_bottom).offset(2);
        make.left.mas_equalTo(_userImageView.mas_right).offset(10);
        make.height.mas_equalTo(24);
        
        
    }];
    
    
    
    _nameAddressLabel = [UILabel new];
    // _nameAddressLabel.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:_nameAddressLabel];
    [_nameAddressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_textStoryLabel.mas_right).offset(3);
        make.top.and.height.mas_equalTo(_textStoryLabel);
        make.width.mas_equalTo(150);
        
    }];
    _nameAddressLabel.textColor = [UIColor colorWithRed:0.320 green:0.740 blue:0.800 alpha:1.000];
    _nameAddressLabel.font = [UIFont fontWithName:@"Arial-BoldItalicMT" size:14];
    //  _nameAddressLabel.text = [[_myDic objectForKey:@"1"]name];
    //  _nameAddressLabel.text = [[dic objectForKey:@"1"]name];
  //  NSMutableDictionary *dicPoi =  model.poi;
  //  _nameAddressLabel.text = [dicPoi objectForKey:@"name"];
    
    
    
    
    UIView *view = [UIView new];
    view.backgroundColor  = [UIColor colorWithWhite:0.774 alpha:0.690];
    [self.contentView addSubview:view];
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_userImageView.mas_bottom).offset(23);
        make.left.mas_equalTo(15);
        make.width.mas_equalTo(SCREEN_WIDTH - 30);
        make.height.mas_equalTo(1);
        
        
    }];
    
    
    _myTextContentLabel = [UILabel new];
    [self.contentView addSubview:_myTextContentLabel];
    //_myTextContentLabel.text = [[_myDic objectForKey:@"1"]text];
    
    _myTextContentLabel.font = [UIFont fontWithName:@"Gill Sans" size:20];
    _myTextContentLabel.textColor = [UIColor colorWithWhite:0.342 alpha:1.000];
    
    _myTextContentLabel.numberOfLines = 0;
    
    [_myTextContentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(view.mas_bottom).offset(28);
        make.left.mas_equalTo(_userImageView);
        make.width.mas_equalTo(view);
        // make.height.mas_equalTo(200);
        
        
    }];
    
    

    
    
     //NSLog(@"1111%@",self.name);
    
    
    
    
    
}

- (void)setMyModel:(YHYReSubSpotModel *)myModel{
    
    
    [self.userImageView sd_setImageWithURL:[NSURL URLWithString:myModel.userImageURL] placeholderImage:PICHOLDEER];
    
    _myLabelName.text = myModel.userName;
    _myTextContentLabel.text = myModel.text;
    
   
  
    
    
    
}
//- (void)presentname:(NSString *)name avatar_m:(NSString *)pic{
//    
//    
//    [self.userImageView sd_setImageWithURL:[NSURL URLWithString:pic] placeholderImage:PICHOLDEER];
//    
//    _myLabelName.text = name;
//    
//    
//    NSLog(@"%@",name);
//    
//   // _myTextContentLabel.text = myModel.text;
//
//}


- (void)awakeFromNib {
    // Initialization code
    //self.contentView.backgroundColor = [UIColor redColor];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
